package com.lap.auth.adapter.config;

import com.lap.auth.domain.dept.repository.DeptRepository;
import com.lap.auth.domain.dept.service.DeptValidator;
import com.lap.auth.domain.dict.repository.DictTypeRepository;
import com.lap.auth.domain.dict.service.DictTypeValidator;
import com.lap.auth.domain.menu.repository.MenuRepository;
import com.lap.auth.domain.menu.service.MenuValidator;
import com.lap.auth.domain.msg.repository.MsgTemplateRepository;
import com.lap.auth.domain.msg.service.MsgTemplateValidator;
import com.lap.auth.domain.project.repository.ProjectRepository;
import com.lap.auth.domain.project.service.ProjectValidator;
import com.lap.auth.domain.region.repository.RegionRepository;
import com.lap.auth.domain.region.service.RegionValidator;
import com.lap.auth.domain.role.repository.RoleRepository;
import com.lap.auth.domain.role.service.RoleValidator;
import com.lap.auth.domain.user.repository.UserRepository;
import com.lap.auth.domain.user.service.UserRoleValidator;
import com.lap.auth.domain.user.service.UserValidator;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class DomainConfig {

  /*
   * 部门领域服务
   */
  @Bean
  DeptValidator deptValidator(DeptRepository repository) {
    return new DeptValidator(repository);
  }

  /*
   * 字典领域服务
   */
  @Bean
  DictTypeValidator dictTypeValidator(DictTypeRepository repository) {
    return new DictTypeValidator(repository);
  }

  /*
   * 菜单领域服务
   */
  @Bean
  MenuValidator menuValidator(MenuRepository repository) {
    return new MenuValidator(repository);
  }

  /*
   * 消息模板领域服务
   */
  @Bean
  MsgTemplateValidator msgValidator(MsgTemplateRepository repository) {
    return new MsgTemplateValidator(repository);
  }

  /*
   * 项目领域服务
   */
  @Bean
  ProjectValidator projectValidator(ProjectRepository repository) {
    return new ProjectValidator(repository);
  }

  @Bean
  RegionValidator regionValidator(RegionRepository repository) {
    return new RegionValidator(repository);
  }

  /*
   * 角色领域服务
   */
  @Bean
  RoleValidator roleValidator(RoleRepository repository) {
    return new RoleValidator(repository);
  }

  /*
   * 用户领域服务
   */
  @Bean
  UserValidator userValidator(UserRepository repository) {
    return new UserValidator(repository);
  }

  @Bean
  UserRoleValidator userRoleValidator(RoleRepository roleRepository) {
    return new UserRoleValidator(roleRepository);
  }
}
